<%--
  Created by IntelliJ IDEA.
  User: longl
  Date: 2020/8/19
  Time: 15:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="basePath.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>ProClinic-医院管理系统Bootstrap4前端框架</title>
    <!-- Fav  Icon Link -->
    <link rel="shortcut icon" type="image/png" href="${basePath}afsets/images/fav.png">
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="${basePath}afsets/css/bootstrap.min.css">
    <!-- themify icons CSS -->
    <link rel="stylesheet" href="${basePath}afsets/css/themify-icons.css">
    <!-- Animations CSS -->
    <link rel="stylesheet" href="${basePath}afsets/css/animate.css">
    <!-- Main CSS -->
    <link rel="stylesheet" href="${basePath}afsets/css/styles.css">
    <link rel="stylesheet" href="${basePath}afsets/css/green.css" id="style_theme">
    <link rel="stylesheet" href="${basePath}afsets/css/responsive.css">
    <!-- morris charts -->
    <link rel="stylesheet" href="${basePath}afsets/charts/css/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="${basePath}afsets/css/jquery-jvectormap.css">
    <link rel="stylesheet" href="${basePath}afsets/datatable/dataTables.bootstrap4.min.css">

    <script src="${basePath}afsets/js/modernizr.min.js"></script>
    <style type="text/css">
        body{
            text-align: center;
        }
    </style>
</head>

<body>
<!-- Pre Loader -->
<div class="loading">
    <div class="spinner">
        <div class="double-bounce1"></div>
        <div class="double-bounce2"></div>
    </div>
</div>
<!--/Pre Loader -->
<!-- Color Changer -->
<div class="theme-settings" id="switcher">
		<span class="theme-click">
			<span class="ti-settings"></span>
		</span>
    <span class="theme-color theme-default theme-active" data-color="green"></span>
    <span class="theme-color theme-blue" data-color="blue"></span>
    <span class="theme-color theme-red" data-color="red"></span>
    <span class="theme-color theme-violet" data-color="violet"></span>
    <span class="theme-color theme-yellow" data-color="yellow"></span>
</div>
<!-- /Color Changer -->
<div class="wrapper">
    <!-- Page Content -->
    <div id="content">
        <!-- Top Navigation -->
        <div class="container top-brand">
            <nav class="navbar navbar-default">
                <div class="navbar-header">
                    <div class="sidebar-header"> <a href="index.html"><img src="${basePath}afsets/images/logo-dark.png" class="logo" alt="logo"></a>
                    </div>
                </div>
                <ul class="nav justify-content-end">
                    <%@include file="loginOut_head.jsp"%>
                </ul>

            </nav>
        </div>
        <!-- /Top Navigation -->
        <!-- Menu -->
        <div class="container menu-nav">
            <nav class="navbar navbar-expand-lg lochana-bg text-white">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
                        aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="ti-menu text-white"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <ul class="navbar-nav mr-auto">
                        <%@include file="headHTML.jsp"%>
                    </ul>
                </div>
            </nav>
        </div>
        <!-- /Menu -->
        <!-- Breadcrumb -->
        <!-- Page Title -->
        <div class="container mt-0">
            <div class="row breadcrumb-bar">
                <div class="col-md-6">
                    <h3 class="block-title">医生s</h3>
                </div>
                <div class="col-md-6">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                            <a href="index.html">
                                <span class="ti-home"></span>
                            </a>
                        </li>
                        <li class="breadcrumb-item">医生s</li>
                        <li class="breadcrumb-item active">All 医生s</li>
                    </ol>
                </div>
            </div>
        </div>
        <!-- /Page Title -->

        <!-- /Breadcrumb -->
        <!-- Main Content -->
        <div class="container">

            <div class="row">
                <!-- Widget Item -->
                <div class="col-md-12">
                    <div class="widget-area-2 lochana-box-shadow">
                        <h3 class="widget-title">医生信息</h3>
                        <div id="update-data" class="update-data"></div>
                        <div class="table-responsive mb-3">
                            <table id="tableId" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th class="no-sort">
                                        <div class="custom-control custom-checkbox">
                                            <input class="custom-control-input" type="checkbox" id="select-all">
                                            <label class="custom-control-label" for="select-all"></label>
                                        </div>
                                    </th>
                                    <th>医生 ID</th>
                                    <th>医生 姓名</th>
                                    <th>科室 </th>
                                    <th>价格 </th>
                                    <th>联系电话 </th>
                                    <th>照片</th>
                                    <th>描述</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${doctors_need}" var="doctor">
                                    <tr>
                                        <td>
                                            <div class="custom-control custom-checkbox">
                                                <input class="custom-control-input" type="checkbox">
                                                <label class="custom-control-label"></label>
                                            </div>
                                        </td>
                                        <td>${doctor.id}</td>
                                        <td>${doctor.dname}</td>
                                        <td>${doctor.deptid}</td>
                                        <td>${doctor.price}</td>
                                        <td>${doctor.tel}</td>
                                        <td><img src="${basePath}${doctor.ppic}" height="150px"/></td>
                                        <td>${doctor.resume}</td>
                                        <td>
<%--                                            <button type="button" class="btn btn-danger mt-3 mb-0" onclick="deleteDoctor(${doctor.id})"><span class="ti-trash"></span>删除</button>--%>
                                                <!-- Modal Button-->
                                                <button type="button" class="btn btn-danger mt-3 mb-0" data-toggle="modal" data-target="#exampleModal${doctor.id}">
                                                    删除
                                                </button>
                                                <!-- /Modal Button-->
                                                <!-- Modal Popup-->
                                                <div class="modal fade" id="exampleModal${doctor.id}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel${doctor.id}" aria-hidden="true">
                                                    <div class="modal-dialog" role="document">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h5 class="modal-title" id="exampleModalLabel">确认框</h5>
                                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                                    <span aria-hidden="true">&times;</span>
                                                                </button>
                                                            </div>
                                                            <div class="modal-body">
                                                                您确认删除${doctor.dname}医生信息吗
                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">返回</button>
                                                                <button type="button" class="btn btn-primary" onclick="deleteDoctor(${doctor.id})">确认删除</button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <!-- /Modal Popup-->
                                            <button type="button" class="btn btn-primary mt-3 mb-0" onclick="queryDoctor(${doctor.id})"><span class="ti-pencil-alt"></span>修改</button>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>

                            <!--Export links-->
                            <button class="btn btn-primary mt-3 mb-0" type="button" onclick="schedule()"><span class="ti-medall" />科室排班</button>
                            <!-- /Export links-->
                        </div>
                    </div>
                </div>
                <!-- /Widget Item -->
            </div>
        </div>
        <!-- /Main Content -->
        <!--Copy Rights-->
        <!-- /Copy Rights-->
    </div>
    <!-- /Page Content -->
</div>
<!-- Back to Top -->
<a id="back-to-top" href="#" class="back-to-top">
    <span class="ti-angle-up"></span>
</a>
<!-- /Back to Top -->
<!-- Jquery Library-->
<script src="${basePath}afsets/js/jquery-3.2.1.min.js"></script>
<!-- Popper Library-->
<script src="${basePath}afsets/js/popper.min.js"></script>
<!-- Bootstrap Library-->
<script src="${basePath}afsets/js/bootstrap.min.js"></script>

<!-- Datatable  -->
<script src="${basePath}afsets/datatable/jquery.dataTables.min.js"></script>
<script src="${basePath}afsets/datatable/dataTables.bootstrap4.min.js"></script>

<!-- Custom Script-->
<script src="${basePath}afsets/js/custom.js"></script>
<script src="${basePath}afsets/js/custom-datatables.js"></script>
<script>
    var dept_id = ${dept_id};
    function deleteDoctor(id) {
        window.location.href="/doctor/deleteDoctor?id="+id+"&dept_id="+dept_id;
    }
    function queryDoctor(id) {
        window.location.href="/doctor/queryDoctor?id="+id+"&dept_id="+dept_id;
    }
    function schedule() {
        window.location.href="/doctor/schedule?dept_id="+dept_id;
    }

    var strs_data="";
    var my_code = ${code};
    //更新了一条数据
    if (my_code == 1){
        strs_data="";
        strs_data+='<div class="lochana-widget">';
        strs_data+='<div class="alert alert-success alert-dismissible fade show" role="alert">';
        strs_data+='已成功更新';
        strs_data+='<a href="#" class="alert-link">一条数据</a>';
        strs_data+='<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
        strs_data+='<span aria-hidden="true">&times;</span>';
        strs_data+='</button>';
        strs_data+='</div>';
        strs_data+='</div>';
        $(".update-data").html(strs_data);
    }else if(my_code == 0){
        strs_data="";
        strs_data+='<div class="lochana-widget">';
        strs_data+='<div class="alert alert-danger alert-dismissible fade show" role="alert">';
        strs_data+='数据更新失败';
        strs_data+='<button type="button" class="close" data-dismiss="alert" aria-label="Close">';
        strs_data+='<span aria-hidden="true">&times;</span>';
        strs_data+='</button>';
        strs_data+='</div>';
        strs_data+='</div>';
        $(".update-data").html(strs_data);
    }
</script>
</body>

</html>
